<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>烟雾文字动画效果</title>
  <link rel="stylesheet" href="style.css">
</head>

<body>
  <section>
    <p class="text">
      Lorem ipsum dolor sit amet consectetur adipisicing elit. Vero dolore voluptas incidunt exercitationem. Consectetur
      fugiat voluptas expedita reprehenderit eius, dicta exercitationem veritatis eos cumque facilis assumenda
      explicabo, rerum possimus tempore.
    </p>
  </section>
</body>
<script>
  const text = document.querySelector('.text')
  text.innerHTML = text.textContent.replace(/\S/g, '<span>$&</span>')

  const letters = document.querySelectorAll('span')
  for (let i = 0; i < letters.length; i++) {
    letters[i].addEventListener('mouseover', () => {
      letters[i].classList.add('active')
    })
  }
</script>

</html>